/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

/**
 *
 * @author ODHeroes
 */
@Entity
@Table(name = "product_probes")
@NamedQueries({
    @NamedQuery(name = "ProductProbes.findAll", query = "SELECT p FROM ProductProbes p"),
    @NamedQuery(name = "ProductProbes.findByProductProbesId", query = "SELECT p FROM ProductProbes p WHERE p.productProbesId = :productProbesId"),
    @NamedQuery(name = "ProductProbes.findByCreatedAt", query = "SELECT p FROM ProductProbes p WHERE p.createdAt = :createdAt"),
    @NamedQuery(name = "ProductProbes.findByOfferPrice", query = "SELECT p FROM ProductProbes p WHERE p.offerPrice = :offerPrice"),
    @NamedQuery(name = "ProductProbes.findByPrice", query = "SELECT p FROM ProductProbes p WHERE p.price = :price"),
    @NamedQuery(name = "ProductProbes.findByProbeDate", query = "SELECT p FROM ProductProbes p WHERE p.probeDate = :probeDate"),
    @NamedQuery(name = "ProductProbes.findByUpdatedAt", query = "SELECT p FROM ProductProbes p WHERE p.updatedAt = :updatedAt")})
public class ProductProbes implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "product_probes_id")
    private BigDecimal productProbesId;
    @Column(name = "created_at")
    @Temporal(TemporalType.DATE)
    private Date createdAt;
    @Column(name = "offer_price")
    private Double offerPrice;
    @Column(name = "price")
    private Double price;
    @Column(name = "probe_date")
    @Temporal(TemporalType.DATE)
    private Date probeDate;
    @Column(name = "updated_at")
    @Temporal(TemporalType.DATE)
    private Date updatedAt;
    @JoinColumn(name = "id_perfil", referencedColumnName = "id_perfil")
    @ManyToOne
    private Perfiles idPerfil;
    @JoinColumn(name = "products_id", referencedColumnName = "products_id")
    @ManyToOne(optional = false)
    private Products productsId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "productProbesId")
    private Collection<EstablishmentsProbes> establishmentsProbesCollection;

    public ProductProbes() {
    }

    public ProductProbes(BigDecimal productProbesId) {
        this.productProbesId = productProbesId;
    }

    public BigDecimal getProductProbesId() {
        return productProbesId;
    }

    public void setProductProbesId(BigDecimal productProbesId) {
        this.productProbesId = productProbesId;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Double getOfferPrice() {
        return offerPrice;
    }

    public void setOfferPrice(Double offerPrice) {
        this.offerPrice = offerPrice;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Date getProbeDate() {
        return probeDate;
    }

    public void setProbeDate(Date probeDate) {
        this.probeDate = probeDate;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Perfiles getIdPerfil() {
        return idPerfil;
    }

    public void setIdPerfil(Perfiles idPerfil) {
        this.idPerfil = idPerfil;
    }

    public Products getProductsId() {
        return productsId;
    }

    public void setProductsId(Products productsId) {
        this.productsId = productsId;
    }

    public Collection<EstablishmentsProbes> getEstablishmentsProbesCollection() {
        return establishmentsProbesCollection;
    }

    public void setEstablishmentsProbesCollection(Collection<EstablishmentsProbes> establishmentsProbesCollection) {
        this.establishmentsProbesCollection = establishmentsProbesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (productProbesId != null ? productProbesId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProductProbes)) {
            return false;
        }
        ProductProbes other = (ProductProbes) object;
        if ((this.productProbesId == null && other.productProbesId != null) || (this.productProbesId != null && !this.productProbesId.equals(other.productProbesId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Model.ProductProbes[ productProbesId=" + productProbesId + " ]";
    }
    
}
